const mongoose = require("mongoose");
mongoose.pluralize(null); //去掉集合后面的s
const { Schema, model } = mongoose;
const versionKey = { versionKey: false };
const moment = require("moment");
moment.locale("zh-cn");

// 管理员账号
const AdminSchema = new Schema(
    {
      email: {
        type: String,
        unique: true,
        trim: true,
      },
      password: {
        type: String,
        trim: true,
        select: false,
      },
      admin_uid: {
        type: String,
        unique: true,
        default: () => new Date().getTime(),
      },
      avatarUrl: {
        type: String,
        default:
          "https://lvyou-1332935562.cos.accelerate.myqcloud.com/ceshi/avatar.png",
      },
      nickname: {
        type: String,
        default: "用户admin",
        trim: true,
      },
    },
    versionKey
  );

module.exports = {
  modelAdministrator: model("administrator", AdminSchema),
};